<?php
class Usuarios_Form_Rol extends Form_Cna {
	
		
	public function __construct($options = null) {
		parent::__construct ( $options );
	}
	
	public function init() {
		
		$this->setName ( 'Rol' );
		$this->setMethod("post");
		
		$id = new Zend_Form_Element_Hidden ( 'codrol' );
		
		$title = new Zend_Form_Element_Text ( 'nombrerol' );
		$title->setLabel ( 'Nombre Rol' )
				->setRequired ( true )
				->addFilter ( 'StripTags' )
				->addFilter ( 'StringTrim' );
				//->addValidator ( 'NotEmpty' );
		
		$description = new Zend_Form_Element_Textarea ( 'descripcion' );
		$description->setLabel ( 'Descripción' )
					->setRequired ( true )
					->setAttrib ( 'rows', 10 )
					->setAttrib ( 'cols', 50 )
					->addFilter ( 'StripTags' )
					->addFilter ( 'StringTrim' )
					->addValidator ( 'NotEmpty' );
		
		$activo = new Zend_Form_Element_Checkbox('activo');
		$activo->setLabel("Activo?");
		$activo->setCheckedValue('S');//esto es opcional
		$activo->setUncheckedValue('N');//esto es opcional
		//si no le asigno valores, por defecto 1 es checked y 0 unchecked
					
		$submit = new Zend_Form_Element_Submit ( 'btnSubmit' );
		$submit->setLabel('Guardar');
		$submit->setValue('Guardar');
		$submit->setAttrib("class", "iceCmdBtn");
		
		$this->addElements ( array ($id, $title, $description, $activo, $submit ) );
		
		$this->loadTableDecorators();
//		$this->loadViewScriptDecorators();
	}
	
	public function loadViewScriptDecorators() {
//		$this->setDecorators ( array ('FormElements', array ('HtmlTag', array ('tag' => 'table' ) ), 'Form' ) );
		$this->setDecorators ( array (array ('viewScript', array ('viewScript' => 'viewscripts/rol_form.phtml' ) ) ) );

	}

}